<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
	</body>
	<script src="./assets/js/jquery.min.js"></script>
	
	
	<script>
		
		roleAjaxPromise = new Promise(function(resolve, reject) {
		   //承诺什么事情
			  $.ajax({
					type:'get',
					url:'http://localhost:8080/api/role/data',
					dataType:'json', 
					success:function(resp){
						if(resp.code===0){	 
							resolve(resp.data);
						}else{
							reject(resp);
						}
					}
					
				 });
   
		});
		
		//异步 模型承诺 成功了
		roleAjaxPromise.then(function(list){
			
			console.log(list);
		});
		//异步 模型承诺 失败了
		roleAjaxPromise.catch(function(reason){
			console.log(reason);
		});
		
		
		
	</script>
	
</html>
